//
//  ViewController.swift
//  Emoji表情扫描
//
//  Created by J on 16/5/7.
//  Copyright © 2016年 J. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var emojiLabel: UILabel!
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    
        let code = "0x2600"
        
        //1.从字符串中取出十六进制
        let scanner = NSScanner(string: code)
        //2.将十六进制转换为字符串
        var result: UInt32 = 0
        scanner.scanHexInt(&result)//最后会把值赋给result
        print(result) //9728
        //3.转换为unicode 字符串
        let emoji =  Character(UnicodeScalar(result))
        print(emoji) //9728

        //3.显示
        emojiLabel.text = String(emoji)
        
    }



}

